package wjh.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import wjh.pojo.Department;
import wjh.pojo.Patient;
import wjh.service.RegisterService;
import wjh.service.ZlyDepartmentService;

import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
@RequestMapping("/department")
public class ZlyDepartmentController {
    @Autowired
    private ZlyDepartmentService zlyDepartmentService;
    @Autowired
    private RegisterService registerService;


    @RequestMapping("/findAll")
    public String findAll(Model model, @RequestParam("id") Integer id, HttpSession session) {
        Patient patient = registerService.findPatientById(id);
        model.addAttribute("patient", patient);
        List<Department> departmentList = zlyDepartmentService.findAll();

        model.addAttribute("departmentList",departmentList);
        return "appoExam";
    }
}
